package com.bgrc.hubu12305.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bgrc.hubu12305.dao.SeatDao;
import com.bgrc.hubu12305.entity.SeatEntity;
import com.bgrc.hubu12305.service.SeatService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Map;

/**
 * 包名:com.bgrc.hubu12305.service.impl
 * 用户:86182
 * 时间:2021121:102021/12/16
 */
@Service
public class SeatServiceImpl extends ServiceImpl<SeatDao, SeatEntity> implements SeatService {
    @Autowired
    private SeatDao seatDao;

    /**
     * 通过车编号和座位等级查座位数
     * */
    @Override
    public Integer querySeatCountByType(String trainNo,Integer type) {
        Integer count = seatDao.querySeatCountByType(trainNo, type);
        return count;
    }

    @Override
    public List<Map<String, Integer>> queryPrice(String trainNo) {
        List<Map<String, Integer>> mapList = seatDao.queryPrice(trainNo);
        return mapList;
    }

    @Override
    public List<Map<String, Object>> queryCarriages(String seatType, String trainNumber) {

        List<Map<String, Object>> carriages = seatDao.queryCarriages(seatType, trainNumber);

        return carriages;
    }


}
